package com.atguigu.srb.core.controller.api;


import com.atguigu.srb.common.result.R;
import com.atguigu.srb.core.pojo.entity.Lend;
import com.atguigu.srb.core.service.LendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 标的准备表 前端控制器
 * </p>
 *
 * @author Mr.bilal
 * @since 2023-07-18
 */
@RestController
@RequestMapping("/api/core/lend")
public class ApiLendController {

    @Autowired
    LendService lendService;

    @GetMapping("/lendList")
    public R getList(){
        List<Lend> lendList = lendService.getList();
        return R.ok().data("lendList",lendList);
    }

    @GetMapping("/show/{lendId}")
    public R show(@PathVariable Long lendId){
        Map<String,Object> lendDetail = lendService.show(lendId);
        return R.ok().data("lendDetail",lendDetail);
    }

}

